{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1 align=\"center\">Task: Prime Numbers </h1>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "What is a prime number?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. Has to be a natural number (postive integer)\n",
    "<br>\n",
    "2. Divisible by exactly 2 natural numbers. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Write a program to make a list of all prime numbers less than 3000 using a while loop. A prime number can only be divided evenly by 1 and itself.\n",
    "<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "make sure to go over why range differs python 2 vs 3 and so on. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2, 3, 5, 7, 11, 13, 17]\n"
     ]
    }
   ],
   "source": [
    "primes = []\n",
    "candidates = range(2,3000)\n",
    "while len(candidates) > 0:\n",
    "    prime = candidates[0]\n",
    "    primes.append(prime)\n",
    "    candidates = candidates[1:]\n",
    "    for x in candidates[:]:\n",
    "        if (x%prime) == 0:\n",
    "            candidates.remove(x)\n",
    "    if len(primes) == 7:\n",
    "        something = len(candidates)\n",
    "        break\n",
    "print(primes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "539"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "something"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**if this tutorial doesn't cover what you are looking for, please leave a comment on the youtube video and I will try to cover what you are interested in. (Please subscribe if you can!)**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://www.youtube.com/watch?v=l_dIleafLZ8"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
